package ArrayList_practice;

import java.util.ArrayList;

import javax.swing.plaf.synth.SynthSpinnerUI;

public class Homework04 {
	public static void main(String[] args) {
		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i=2;i<10;i++){
			boolean sign = true;
			for (int j=2;j<i;j++){
				if (i%j == 0){
					sign = false;
					break;
				}
			}
			if (sign){
				list.add(i);
			}
		}
		for (int i=10;i<100;i++){
			boolean sign = true;
			for (int j=2;j<i;j++){
				if (i%j ==0 ){
					sign = false;
					break;
				}
			}
			if (sign && i/10 == i%10){
				list.add(i);
			}
		}
		for (int i=100;i<1000;i++){
			boolean sign = true;
			for (int j=2;j<i;j++){
				if (i%j == 0){
					sign = false;
					break;
				}
			} 
			if (sign && i/100 == i%10){
				list.add(i);
			}
		}
		for (int j=0;j<list.size();j++){
			System.out.print(list.get(j)+" ");
			if (j%10 == 0 && j != 0){
				System.out.println();
			}
		}
	}
}
